/*
 * @Author: c
 * @Date: 2024-01-12 12:53:32
 * @LastEditTime: 2024-03-29 20:11:31
 * @LastEditors: c
 * @Description: 
 * @FilePath: \music-web-backend\src\core\music\album\dto\search-album.dto.ts
 * https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Transform } from 'class-transformer';
import { IsArray, IsNumber, IsOptional, IsString } from 'class-validator';
import { PageDto } from 'src/common/dto/page.dto';
import { Artist } from '../../artist/entities/artist.entity';
import { SongDto } from '../../song/dto/search-song.dto';
import { Pic } from './create-album.dto';
// Copyright 2024 Administrator
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.



//专辑类型

export class AlbumDto {

    id: number
    //封面图
    pic: Pic | string;
    //是否可用
    available: boolean;
    //不可用时的报错信息
    availableErrMsg: string;
    //当前用户是否喜欢
    isFavorite: boolean = false;
    //被点击喜欢的总数
    favoriteCount: number;
    //当前用户是否购买此专辑
    isPaid: boolean = false;

    //专辑唯一代码（P10004217236）
    albumAssetCode: string;

    //发行日期
    releaseDate: Date;

    //专辑介绍
    introduce: string;

    //专辑标题
    title: string;

    //专辑分类（流行）
    genre: string;

    //语言（中文）
    lang: string;


    //本站推出时间
    pushTime: Date;

    //本站下架时间
    downTime: string;


    //专辑中歌曲列表
    trackList: SongDto[];

    //所属的歌手列表
    artist: Artist[];


    //23
    cpId: number = 23;

    //6976364785171
    upc: string = '6976364785171';

    //支付类型？
    pay_model: number = 2;

    //专辑类型？
    type: number = 2;

    //排行榜分数？（1.0000471）
    _score: number = 1.0000471;
}


export class AlbumPageQuery extends PageDto {
    @IsOptional()
    alubmName: string
    @IsOptional()
    @IsString()
    keywords?: string

    @IsOptional()
    @IsArray()
    @Transform(arr => arr.map(a => +a))
    @IsNumber({ allowNaN: false }, { message: "歌手id必须是数字", each: true })
    artistIds?: number[]
}